package day1

import org.apache.flink.api.scala.ExecutionEnvironment

object _01_WordCountBatch_Scala {
  def main(args: Array[String]): Unit = {

    //1.flink环境
    val env = ExecutionEnvironment.getExecutionEnvironment

    //2.创建source
    val source = env.readTextFile("data/wc/wc.txt")

    //3.根据业务 对数据进行逻辑处理  transform
    import org.apache.flink.api.scala._
    source.flatMap(_.split(" "))
      .map((_, 1))
      .groupBy(0)
      .sum(1)

      //4.sink 输出
      .print()


  }

}
